﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Abp.Application.Services.Dto;
using DM.Controllers;
using DM.Tests;
using DM.Web.Models.Test;
using Microsoft.AspNetCore.Mvc;

namespace DM.Web.Mvc.Controllers
{
    public class TestController : DMControllerBase
    {
        private readonly ITestAppService _testAppService;

        public TestController(ITestAppService testAppService)
        {
            this._testAppService = testAppService;
        }
        public IActionResult Index()
        {
            return View();
        }

        public async Task<PartialViewResult> CreateOrEditModal(int? id)
        {
            var dto = await _testAppService.GetTestForEditAsync(new NullableIdDto<int> {Id=id });
            var viewModel = new CreateOrEditTestModel(dto.TestEditDto);
            return PartialView("CreateOrEditModal", viewModel);
        }
    }
}